// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
// import Vconsole from 'vconsole'
import App from './App'
import router from './router'
import Vant from 'vant'
import { Toast } from 'vant'
import 'lib-flexible/flexible'
import * as echarts from 'echarts'
Vue.prototype.$echarts = echarts
// let vConsole = new Vconsole();
import 'vant/lib/index.css'
import axios from 'axios'
Vue.config.productionTip = false
// Vue.use(vConsole);
Vue.use(Vant);
Vue.prototype.$axios = axios;
Vue.use(Toast);
router.beforeEach((to, from, next) => {
  if (to.path === '/login') return next();
  const token = window.localStorage.getItem('token');
  if (!token) return next('/login');
  next()
});
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
});
